﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BlockEngine.World
{
    class BlockDictionary
    {
        public static Dictionary<string, BlockProperties> Blocks = new Dictionary<string, BlockProperties>();
        public static Dictionary<short, string> IDs = new Dictionary<short, string>();
        public static void AddBlock(BlockProperties Properties)
        {
            Blocks.Add(Properties.Name, Properties);
            IDs.Add(Properties.ID, Properties.Name);
        }
        public static BlockProperties GetBlockByName(string Name)
        {
            BlockProperties Block;
            Blocks.TryGetValue(Name, out Block);
            return Block;
        }
        public static BlockProperties GetBlockByID(short ID)
        {
            BlockProperties Block;
            string Name;
            IDs.TryGetValue(ID, out Name);
            Blocks.TryGetValue(Name, out Block);
            return Block;
        }
    }
}
